#include<iostream>
using namespace std;
int main(void)
{
	int n,sum;
	sum=0;
	cin>>n;
	while(1)
	{
		sum+=n%10;
		n=n/10;
		if(n%10==0)
			break;
	}

	cout<<sum;
	return 0; 
	
}
